home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / share / doc / libqimageblitz4 / README.PORTING < prev   
Text File  |  2007-11-07  |  4KB  |  130 lines

  1. I. Introduction.
  2.  
  3. Since most people using this are going to be porting code from KImageEffect
  4. I've written a small porting guide to help you out. This is broken into two
  5. main sections: "Depreciated And Removed Items", which describes methods that
  6. have been removed, and "Changed Methods And Parameters", which describes 
  7. methods that are still there but have changed names or parameters.
  8.  
  9. This document just describes API changes. It does not discuss if the actual 
  10. method's algorithm has changed. Many have so may give different results. For a
  11. general overview of some of these changes see README.BLITZ.
  12.  
  13. Daniel M. Duley <daniel.duley@verizon.net>
  14.  
  15. II. Depreciated And Removed Items.
  16.  
  17. *
  18. * rotate()
  19. *
  20. QImage::transformed() now has efficient special cases to handle right angles 
  21. and performance should be fine. Use that instead.
  22.  
  23. *
  24. * hash()
  25. * shade()
  26. * solarize()
  27. *
  28. These were removed because they either weren't being used much, were expensive,
  29. or in the case of solarize rather stupid, (at least how I coded it ;-).
  30.  
  31. *
  32. * blend():
  33. * blendOnLower():
  34. * flatten():
  35. * modulate():
  36. * selectedImage():
  37. *
  38. I suspect the removal of these methods are probably what is going to cause a 
  39. the most porting problems. They were primarily used to generate special image 
  40. overlays and highlights. 
  41.  
  42. The problem with them is they are a huge amount of unmaintained code and now 
  43. QPainter has very well designed alphablending and raster operations that make
  44. them obsolete. Your better off using QPainter.
  45.  
  46. If your like me you might first balk at doing this because it seems like
  47. overkill to use QPainter just to do a highlight, but it's now really efficient 
  48. at blending and raster ops. If you don't believe me look at Qt's 
  49. src/gui/painting/qdrawutil.* and qpaintengine_raster. It's really rather 
  50. amazing at how optimized it is, at least to me >:)
  51.  
  52. Here is a little example to get you started. This will highlight an image 
  53. contained in "image" with a blue overlay while still retaining the original 
  54. alpha channel:
  55.  
  56. // Upgrade if needed for alphablending
  57. if(image.format() != QImage::Format_ARGB32_Premultiplied &&
  58.     image.format() != QImage::Format_ARGB32)
  59.       image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
  60.  
  61. // Draw our overlay
  62. QPainter p;
  63. p.begin(&image);
  64. // Keep original image alpha channel
  65. p.setCompositionMode(QPainter::CompositionMode_SourceAtop);
  66. // Replace this color with your overlay's color and alpha value
  67. p.fillRect(image.rect(), QColor(0, 0, 255, 64));
  68. // Done
  69. p.end();
  70.  
  71. To do a pixmap is very similiar and is what KPixmapEffect::selectedPixmap()
  72. used to do when updated to Qt4, (thanks to Fredrik).
  73.  
  74. III. Changed Methods And Parameters.
  75.  
  76. *
  77. * toGray()
  78. *
  79. Changed to grayscale() because the meaning of the bool parameter has changed.
  80.  
  81. *
  82. * contrast()
  83. * contrastHSV()
  84. *
  85. There are no longer two contrast methods, just contrast(), and it takes the
  86. same parameters that contrastHSV() used to.
  87.  
  88. *
  89. * charcoal()
  90. *
  91. No longer takes a radius or sigma.
  92.  
  93. *
  94. * edge()
  95. *
  96. The default edge algorithm has changed and no longer takes a radius parameter. 
  97. For the old behavior use convolveEdge() instead.
  98.  
  99. *
  100. * blur()
  101. The default blur algorithm has changed and now just takes an integer radius. 
  102. For the old behavior use gaussianBlur() instead.
  103.  
  104. *
  105. * oilPaint()
  106. * oilPaintConvolve()
  107. *
  108. There is now only the oilPaint() method since we now have very efficient 
  109. convolution. It takes the same parameters that oilPaintConvolve() used to.
  110.  
  111. *
  112. * sharpen()
  113. *
  114. The sharpen method that took a single factor parameter has been depreciated 
  115. and removed. Use the other convolve-based sharpen() that takes a radius and 
  116. sigma instead.
  117.  
  118. *
  119. * threshold()
  120. *
  121. Now takes a channel enum to threshold as well as "on" and "off" colors.
  122. The default values are the same.
  123.  
  124. *
  125. * channelIntensity()
  126. *
  127. Shares the same enum as threshold().
  128.  
  129.